Skip to content

Conversation

beckermarc
Copy link
Contributor

No description provided.

@beckermarc beckermarc requested a review from smahati as a code owner August 5, 2025 15:05
@MattSchur MattSchur changed the title Docs for typed result APIs Java: Typed Results Aug 28, 2025
@renejeglinsky renejeglinsky merged commit 4a6f13d into main Sep 2, 2025
7 checks passed
@renejeglinsky renejeglinsky deleted the typed-result branch September 2, 2025 12:41
@@ -322,7 +322,7 @@ CqnSelect query = Select.from(BOOKS)
.where(b -> b.ID().ne(bookId).and(similarity.gt(0.9)))
.orderBy(b -> b.get("similarity").desc());

CdsResult<?> similarBooks = db.run(select, CdsVector.of(embedding));
Result similarBooks = db.run(query, CdsVector.of(embedding));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The way that you are changed back these code examples they are now dependant on the setting for typed queries or not. If BOOKS is used with a LinkedStructuredType (and usage of CqnSelect would be avoided via var) this code example would produce a compilation error now. That's what I tried to avoid by using consistently CdsResult<?> everywhere, as this is the correct supertype, that will always work.

Otherwise I think it is hard to understand when to use Result, CdsResult<?> or CdsResult<Books>. I think Result should be largely replaced by CdsResult to make things more consistent.

This also applies to other locations changed back within these diffs: https://github.com/capire/docs/pull/2006/files/f875bf04d9ee79f64002594e9a9f6cf7b50c670d..45bb6fe5a63d5e2a16d397d718374772d1270669

@@ -397,7 +397,7 @@ To select the mapping elements of a managed association, simply add the [associa
CqnSelect select = Select.from(BOOKS).byId(123)
.columns(b -> b.author());

CdsData row = persistence.run(select).single();
Row row = persistence.run(select).single();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above applies here, if select would retain Select<Books>, this would result in a compilation error. I think CdsData should be preferred over Row, as again it is the common supertype of all variants.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants